import { HTTP } from '../utils/http'
import mpx from '@mpxjs/core'
import apiProxy from '@mpxjs/api-proxy'
import configAPI from '~/utils/config.js'

mpx.use(apiProxy, {
  usePromise: true
})

class UploadRencentPhoto extends HTTP {
  async uploadDoumiImg(data) {
    wx.showLoading({
      title: '上传近照中',
      mask: true
    })
    try {
      const oRes = await this.request({
        url: '/sea/api/1.0/client/v1/xinshui/face_compare?dmclient=weixinxcx',
        data,
        method: 'POST'
      })
      wx.hideLoading()
      return oRes
    } catch (error) {
      wx.hideLoading()
    }
  }

  async getToken(data = {}) {
    console.log(123)
    wx.showLoading({
      title: '跳转中...',
      mask: true
    })
    try {
      const res = await this.request({
        url: '/sea/api/1.0/client/v1/xinshui/faceid/get_token?dmclient=weixinxcx',
        data,
        method: 'POST'
      })
      wx.hideLoading()
      return res
    } catch (error) {
      wx.hideLoading()
    }
  }

  async getFaceResult(data = {}) {
    wx.showLoading({
      title: '获取结果中...',
      mask: true
    })
    try {
      const res = await this.request({
        url: '/sea/api/1.0/client/v1/xinshui/faceid/get_result?dmclient=weixinxcx',
        data,
        method: 'GET'
      })
      console.log('dddddddd', res)
      wx.hideLoading()
      return res
    } catch (error) {
      wx.hideLoading()
    }
  }
}

export { UploadRencentPhoto }
